'use strict';

/**
 * @param {Egg.Application} app - egg application
 */
module.exports = app => {
  const { router, controller, middleware } = app;
  // 登录
  router.post('/login', controller.home.login);
  // 网站
  router.get('/http',middleware.jwt(app.config.jwt), controller.http.get);
  router.post('/http',middleware.jwt(app.config.jwt), controller.http.post);
  router.put('/http',middleware.jwt(app.config.jwt), controller.http.put);
  router.delete('/http',middleware.jwt(app.config.jwt), controller.http.delete);
  //  广告
  router.get('/advertisement/:httpid',middleware.jwt(app.config.jwt), controller.advertisement.get);
  router.post('/advertisement',middleware.jwt(app.config.jwt), controller.advertisement.post);
  router.put('/advertisement',middleware.jwt(app.config.jwt), controller.advertisement.put);
  router.delete('/advertisement',middleware.jwt(app.config.jwt), controller.advertisement.delete);
  // demo测试
  router.get('/demo/:httpid',middleware.jwt(app.config.jwt), controller.home.demo);
  // 底部信息
  router.get('/foot/:httpid',middleware.jwt(app.config.jwt), controller.foot.get);
  router.post('/foot',middleware.jwt(app.config.jwt), controller.foot.post);
  router.put('/foot',middleware.jwt(app.config.jwt), controller.foot.put);
  router.delete('/foot',middleware.jwt(app.config.jwt), controller.foot.delete);
  // title信息
  router.get('/info/:httpid',middleware.jwt(app.config.jwt), controller.info.get);
  router.post('/info',middleware.jwt(app.config.jwt), controller.info.post);
  router.put('/info',middleware.jwt(app.config.jwt), controller.info.put);
  router.delete('/info',middleware.jwt(app.config.jwt), controller.info.delete);
  // 上传图片
  router.post('/upimg', controller.home.upimg);

  router.get('/api/foot', controller.foot.getapi);
  router.get('/api/advertisement', controller.advertisement.getapi);
  router.get('/api/info', controller.info.getapi);
    // 获取开奖数据
  router.get('/api/getdata', controller.home.index);
};
